/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ysw.action;

import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import ysw.jdbc.RechargeJdbc;

import ysw.vo.Recharge;

/**
 *
 * @author Administrator
 */
public class RechargeAction extends ActionSupport{
    private Recharge recharge;

    public Recharge getRecharge() {
        return recharge;
    }

    public void setRecharge(Recharge recharge) {
        this.recharge = recharge;
    }

    
    private List<Recharge> rechargeList;
    public String execute() throws Exception{
        RechargeJdbc rechargeJ=new RechargeJdbc();
        recharge.setId(recharge.getId());
        recharge.setDescribe(recharge.getDescribe());
    
    
        rechargeJ.addRecharge(recharge);
        return SUCCESS;
    }

public String showAllRecharge() throws Exception{
     Recharge recharge=new Recharge();
    RechargeJdbc rechargeJ=new RechargeJdbc();
     
        try{
            rechargeList=rechargeJ.showRecharge();
        }catch(SQLException e){
            e.printStackTrace();
        }
     
	Map request=(Map)ActionContext.getContext().get("request");
        request.put("rechargeList",rechargeList);
        return SUCCESS;
    }
}
